package com.base.cn.platform.os.service.exam.question;

import com.base.cn.platform.os.service.FeignAuthConfig;
import com.base.cn.platform.os.service.exam.ExamBaseService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 试题导入接口
 *
 * @author s.li
 * @date 2019/01/02
 */
@FeignClient(name = ExamBaseService.appName,configuration = FeignAuthConfig.class)
public interface ExamQuestionImportService extends ExamBaseService {

    /**
     * 保存导入的试题数据
     * @param templateContentList 试题数据列表
     * @param subjectIds 专业ID串
     * @param loresetPointIds 考点ID串
     * @param sysUserId 管理员ID
     * @return Map<String,Object>
     */
    @RequestMapping(contextPath + "/saveImportQuestion")
    Map<String,Object> saveImportQuestion(@RequestBody List<Map<String, Object>> templateContentList,
                                          @RequestParam("subjectIds") String subjectIds,
                                          @RequestParam("loresetPointIds") String loresetPointIds,
                                          @RequestParam("sysUserId") BigDecimal sysUserId);

    /**
     * 执行导入试题文件
     * @param file 试题文件
     * @param type 类型，1 Word ,2 Excel
     * @param sysUserId 创建的系统用户ID
     * @return Map<String, Object>
     */
    @RequestMapping(value = contextPath + "/importQuestionFile", method = {RequestMethod.POST}, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    Map<String,Object> importQuestionFile(@RequestPart(value = "file") MultipartFile file,
                                          @RequestParam("type") int type,
                                          @RequestParam("sysUserId") BigDecimal sysUserId);
}
